import request from '../req'
import type { PageRowsDto, PageReqDto } from '../type'
// 查询允许迁移的长期保数据
export const getquerymigrationperiodlistapi = async (params: any) => {
    const res = await request.get(
        '/period-insur/staff-record/query-migration-period-list',
        {
            params: params,
        }
    )
    return res
}

// 查询长期工保司
export const getqueryperiodinsurancecompanyapi = async () => {
    const res = await request.get(
        '/insur/insurComInsuranceCompany/query-period-insurance-company'
    )
    return res
}

// 查询允许迁移的长期保人员列表
export const getquerymigrationperiodstafflistapi = async (
    params: any,
    config = {}
) => {
    const res = await request.get(
        '/period-insur/staff-record/query-migration-period-staff-list',
        {
            params: params,
            ...config,
        }
    )
    return res
}

// 迁移数据
export const migrationperioddataapi = async (data: any) => {
    const res = await request.post(
        '/period-insur/staff-record/migration-period-data',
        data
    )
    return res
}

// 查询迁移方案
export const querymigrationperiodplansbycompanyidapi = async (data: any) => {
    const res = await request.get(
        '/period-insur/staff-record/query-migration-period-plans-by-company-id',
        { params: data }
    )
    return res
}

// 查询长期保方案
export const getwesureplansapi = async (data: any) => {
    const res = await request.get('/wesure/wesure-plan/get-wesure-plans', {
        params: data,
    })
    return res
}

export interface MigrationOperationLogIiemDto {
    id: null
    operationLogId: string
    operationLogIds: null
    companyId: number
    companyName: string
    beforeInsurCompany: string
    beforeOperateRecordId: null
    beforeCompanyPlanId: null
    beforeInsurCompanyPlanCode: null
    beforeCompanyPlanName: null
    laterInsurCompany: string
    laterOperateRecordId: null
    laterCompanyPlanId: null
    laterInsurCompanyPlanCode: null
    laterCompanyPlanName: null
    operationDate: string
    isDelete: null
    createTime: null
    createUserId: null
    updateTime: null
    updateUserId: null
    totalCount: number
    revokeStatus: null
    staffList: null
    migrationOperationLogDetails: MigrationOperationLogDetailDto[]
}

export interface MigrationOperationLogDetailDto {
    id: number
    operationLogId: string
    operationLogIds: null
    companyId: number
    companyName: string
    beforeInsurCompany: string
    beforeOperateRecordId: null | number
    beforeCompanyPlanId: number
    beforeInsurCompanyPlanCode: string
    beforeCompanyPlanName: string
    laterInsurCompany: string
    laterOperateRecordId: null | number
    laterCompanyPlanId: null | number
    laterInsurCompanyPlanCode: null | string
    laterCompanyPlanName: null | string
    operationDate: string
    isDelete: number
    createTime: number
    createUserId: number
    updateTime: null
    updateUserId: null
    totalCount: null | number
    revokeStatus: number
    staffList: null
    migrationOperationLogDetails: null
}
/**
 * 查询长期保迁移保司操作日志列表
 * @returns
 */
export const getMigrationOperationLogListApi = async (
    data: PageReqDto
): Promise<PageRowsDto<MigrationOperationLogIiemDto>> => {
    return await request.get('/period-insur/migration-operation-log/list', {
        params: data,
    })
}

/**
 * 撤销迁移操作
 * @returns
 */
export const migrationOperationLogRevokeApi = async (data: {
    operationLogId: number | string
}) => {
    return await request.post(
        `/period-insur/migration-operation-log/revoke/${data.operationLogId}`
    )
}
